The present invention relates, in general, to image analysis and, in particular, to segmenting individual characters or words.
Extracting text from a color image, especially from a color image where the text is integrated with a graphic, is useful for optical character recognition and for conducting a text search. In the present invention, text integrated with a graphic means that the text and the graphic are not located in separate regions of the image but are combined somehow (e.g., overlaid). Color images that integrate text and graphics communicate in an immediate and effective manner and are widely used. However, such images are often a complex mixture of shapes and colors arranged in unpredictable ways which make it difficult to automatically extract or separate the text from the rest of the color image.
Systematic attempts to understand notions of color go back at least to Newton""s light experiments with prisms in the 17th century, and have been considerably formalized and expanded since, most notably by Huygens, Young, von Helmholtz, and Maxwell. Numerically, the notion of color has largely been reduced to a wavelength measurement of an electromagnetic light wave. In addition, the structure of color receptors in the human eye has motivated the choice of three colors, namely red, green, an d blue (RGB), from which most other colors may be obtained by suitable weighted combinations. In 1931, the International Commission on Illumination (CIE) standardized the wavelengths of these three colors as: Red=700 nm, Green=546.1 nm, and Blue=435.8 nm, where 1 nm=10xe2x88x929 m. The fundamental RGB system is still prevalent today, used for color monitors, color scanners, video cameras, and digital file formats such as TIFF, JPEG, and BMP.
Mathematically, the RGB system may be thought of as a basis, from which other color coordinate systems may be derived via linear or non-linear transformations, depending on the particular application at hand. The general intention has been to define color specifications in standard, well-accepted terminology, resulting in reproducible results across many media. Some examples of color coordinate systems derived via linear transformations of RGB are the Luminance (usually called grayscale), In-phase chrominance, and Quadrature chrominance (YIQ), a system used for TV signals in the United States; the Cyan, Magenta, Yellow (CMY) subtractive system used in color printing; and several XYZ Cartesian systems defined by the CIE. Some non-linear examples include the Luminance, a-chrominance, and b-chrominance (Lab) system; the Luminance, u-chrominance, and v-chrominance (Luv) system; and the Hue, Saturation, and Brightness (HSB) system and its variants: hue, saturation, and value (HSV); hue, saturation, and intensity (HSI); and hue, lightness, and saturation (HLS).
In the digital domain (where image components are doubly-indexed pixel matrices with integer entries) a typical 24-bit RGB image is an overlay of three eight-bit images; thus each pixel component (e.g., R in RGB) ranges in value from 0 to 255, and is represented by an eight-bit binary number. The value of a pixel""s color component represents the intensity of that color component. Therefore, a color component may be assigned one of 256 values when represented by an eight-bit binary number. A color component value of zero means that none of that color component contributes to the color of the pixel. For example, if R in RGB has a value of 0 then no red color is present in the pixel.
A digital color image may be easily converted from one color coordinate system to another. As a linear example, an image in RGB may be converted to an image in YIQ by converting each pixel in the RGB image to a pixel in YIQ as follows:
Yij=0.299Rij+0.587Gij+0.114Bij,
where Yij is the ij pixel entry of the resulting Luminance channel, and Rij is the ij pixel value of the red component, Gij is the ij pixel value of the green component, and Bij is the ij pixel value of the blue component; similarly,
Iij=0.596Rijxe2x88x920.274Gijxe2x88x920.322Bij
Qij=0.211Rijxe2x88x920.523Gij+0.312Bij
for the in-phase and quadrature chrominance components Iij and Qij.
Conversion from RGB to Lab provides an example of a non-linear coordinate transformation. It is given as
Lij=10(Gij)1/2,
aij=(Rijxe2x88x92Gij)/(Rij+2Gij+Bij), and
bij=0.4(Gijxe2x88x92Bij)/(Rij+2Gij+Bij).
U.S. Pat. No. 5,802,203, entitled xe2x80x9cIMAGE SEGMENTATION USING ROBUST MIXTURE MODELS,xe2x80x9d discloses a method of modeling an image, which may include text, as a compilation of layers having different brightness functions to prevent corruption of the image due to noise or to compress the image. The method of U.S. Pat. No. 5,802,203 does not extract text from a color image that includes graphics as does the present invention. U.S. Pat. No. 5,802,203 is hereby incorporated by reference into the specification of the present invention.
U.S. Pat. No. 5,956,468, entitled xe2x80x9cDOCUMENT SEGMENTATION SYSTEM,xe2x80x9d discloses a method of identifying those regions in a document that contain an image and regions that contain text so that dithering techniques for printing may be used only on images. U.S. Pat. No. 5,956,468 requires an image to be separate from text. Therefore, U.S. Pat. No. 5,956,468 cannot extract text that is an integral part of an image as does the present invention. U.S. Pat. No. 5,956,468 is hereby incorporated by reference into the specification of the present invention.
It is an object of the present invention to extract text from a color image.
It is another object of the present invention to extract text from a color image, where the text is integrated with a graphic.
The present invention is a method of extracting text from a color image in three steps: image reception, grayscale conversion, and binarization.
The first step is receiving a color image, where the image includes pixels, where each pixel is represented by a color component system selected from the color component systems consisting of RGB, YIQ, CMY, XYZ, Lab, Luv, HSB, HSV, HSI, and HLS.
The second step is converting the color image received into a grayscale image in a manner that maximizes the contrast between any text in the image and the rest of the image. It is this second step that is crucial to the text extraction process. Five different conversion methods (i.e., C1, C2, C3, C4n, and C5n) are used to generate one or more grayscale images. C1, C2, and C3 each generate one grayscale image while C4n and C5n each generate six grayscale images if a pixel is made up of three color components. To avoid division by zero, the corresponding value of the color component of the received image is biased upward by one. The five conversion methods apply pixel-wise as follows:
C1ij=avg(Rij, Gij)=(Rij+Gij)/2;
C2ij=min(Rij, Gij, Bij)/avg(Rij, Gij, Bij);
C3ij=min(Rij, Gij, Bij)/max(Rij, Gij, Bij); and
C4nij=one(Rij, Gij, Bij)/another(Rij, Gij, Bij); and
C5nij=comb(Rij, Gij, Bij)/sum(Rij, Gij, Bij).
The third step of the method is comparing each pixel value in each grayscale image resulting from the second step to a threshold T and setting the value of the grayscale pixel to a first value (e.g., 0) if the value of grayscale pixel is not greater than T; otherwise, setting the value of the grayscale pixel to a second value (e.g., 1). The third step results in the binarization of the grayscale images resulting from the second step. The threshold is defined by the following equation:
T=min(Cmij)+k*std(Cmij), or alternatively as
T=max(Cmij)xe2x88x92k*std(Cmij),
where * denotes multiplication, and where m=1, 2, 3, 4n, and 5n., The result of the third step is a set of black and white images where any text in the color image received appears as either black text against a white background or white text against a black background. The result of the third step may be processed further by an optical character reader or a search engine.